<%@ page
	import="cn.firstsoft.firstframe.plugins.rtx.RtxUtils,org.springside.modules.security.domain.UserSession,org.springside.core.Constants"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%
	session.setAttribute("messageTimes", "0");
%>
<fmt:message key="header_menu_message" var="header_menu_message" />
<fmt:message key="header_menu_email" var="header_menu_email" />
<fmt:message key="header_menu_forum" var="header_menu_forum" />
<fmt:message key="header_menu_address" var="header_menu_address" />
<fmt:message key="header_menu_setting" var="header_menu_setting" />
<fmt:message key="header_menu_help" var="header_menu_help" />
<fmt:message key="header_menu_exit" var="header_menu_exit" />

<fmt:message key="header_link_hint" var="header_link_hint" />
<fmt:message key="header_shortcut_1" var="header_shortcut_1" />
<fmt:message key="header_shortcut_2" var="header_shortcut_2" />
<fmt:message key="header_shortcut_3" var="header_shortcut_3" />
<fmt:message key="header_show_hide" var="header_show_hide" />
<fmt:message key="header_menu_more" var="header_menu_more" />
<c:set var="modulenum" value="12" />
<html>
<head>
<title><fmt:message key="head.title" /> - ${sessionScope.loginUser.name}</title>
<%@ include file="/common/meta.jsp"%>
<link href="<c:url value="/themes/${sessionScope.loginUser.theme}/style.css"/>"
	type="text/css" rel=stylesheet>
<link href="<c:url value="/themes/${sessionScope.loginUser.theme}/navigation.css"/>"
	type=text/css rel=stylesheet>
<link href="<c:url value="/themes/${sessionScope.loginUser.theme}/extremecomponents.css"/>" 
	type="text/css" rel=stylesheet>
<SCRIPT language=javascript
	src="<c:url value="/themes/${sessionScope.loginUser.theme}/cookie.js"/>"></SCRIPT>
<SCRIPT language=javascript
	src="<c:url value="/themes/${sessionScope.loginUser.theme}/menu.js"/>"></SCRIPT>
<SCRIPT language=javascript 
	src="<c:url value="/scripts/admin.js"/>"></SCRIPT>
</head>
<BODY onmouseout="closeMenus();">
<%
	if ("true".equals(Constants.RTX)) {
%>
<%
	UserSession userSession = (UserSession) session
				.getAttribute("loginUser");
		String loginid = "";
		if ("true".equals(Constants.EAS)) {
			loginid = userSession.getName();
		} else {
			loginid = userSession.getLoginid();
		}
		String sessionKey = RtxUtils.getSessionKey(loginid);
%>
<script language="vbscript"> 
Function loginRtx()
   Set objProp = RTXAX.GetObject("Property") 
   objProp.Value("RTXUsername") = "<%=loginid%>" 
   objProp.Value("LoginSessionKey") = "<%=sessionKey%>" 
   objProp.Value("ServerAddress") = "<%=Constants.RTX_SERVER%>" 
   objProp.Value("ServerPort") = <%=Constants.RTX_PORT%>
   RTXAX.Call 2, objProp 
End Function
</script>
<OBJECT id=RTXAX
	data=data:application/x-oleobject;base64,fajuXg4WLUqEJ7bDM/7aTQADAAAaAAAAGgAAAA==
	classid=clsid:5EEEA87D-160E-4A2D-8427-B6C333FEDA4D VIEWASTEXT>
</OBJECT>
<%
	}
%>
<script language="vbscript">
	Function str2asc(strstr) 
	 	str2asc = hex(asc(strstr)) 
	End Function 
	Function asc2str(ascasc) 
	 	asc2str = chr(ascasc) 
	End Function
</script> 
<script type="text/javascript">
function encode(str){ 
	var ret=""; 
	var strSpecial="!\"#$%&'()*+,/:;<=>?[]^`{|}~%"; 
	var tt= "";

	for(var i=0;i<str.length;i++){ 
		var chr = str.charAt(i); 
		var c=str2asc(chr); 
		tt += chr+":"+c+"n"; 
		if(parseInt("0x"+c) > 0x7f){ 
			ret+="%"+c.slice(0,2)+"%"+c.slice(-2); 
		}else{ 
			if(chr==" ") 
				ret+="+"; 
			else if(strSpecial.indexOf(chr)!=-1) {
				if (chr=="&") {
					ret+="%"+"7C";
				} else {
					ret+="%"+c.toString(16);
				}
			} else 
				ret+=chr; 
		} 
	} 
	return ret; 
} 
function decode(str){ 
	var ret=""; 
	for(var i=0;i<str.length;i++){ 
		var chr = str.charAt(i); 
		if(chr == "+"){ 
			ret+=" "; 
		}else if(chr=="%"){ 
			var asc = str.substring(i+1,i+3); 
			if(parseInt("0x"+asc)>0x7f){ 
				ret+=asc2str(parseInt("0x"+asc+str.substring(i+4,i+6))); 
				i+=5; 
			}else{ 
				ret+=asc2str(parseInt("0x"+asc)); 
				i+=2; 
			} 
		}else{ 
			ret+= chr; 
		} 
	} 
	return ret; 
} 
var currentmodule = '${currentmodule}';
function toggleMenu(menu) {
	currentmodule = menu;
	try {
		<c:forEach items="${modules}" var="module">
		document.getElementById("${module.path}_left_img").src="../../themes/${sessionScope.loginUser.theme}/images/otherheadTab_left.gif";
		document.getElementById("${module.path}_right_img").src="../../themes/${sessionScope.loginUser.theme}/images/otherheadTab_right.gif";
		document.getElementById("${module.path}_td").className ="otherTab";
		document.getElementById("${module.path}_td").style.backgroundImage="url(../../themes/${sessionScope.loginUser.theme}/images/otherheadTab_middle.gif)";
		</c:forEach>
		document.getElementById(menu + "_left_img").src="../../themes/${sessionScope.loginUser.theme}/images/currentheadTab_left.gif";
		document.getElementById(menu + "_right_img").src="../../themes/${sessionScope.loginUser.theme}/images/currentheadTab_right.gif";
		document.getElementById(menu + "_td").className="currentTab";
		document.getElementById(menu + "_td").style.backgroundImage="url(../../themes/${sessionScope.loginUser.theme}/images/currentheadTab_middle.gif)";
	} catch (e) {
	}
}

function hideHeader(){

	if(this.document.getElementById('header_logo').style.display=='none'){
		this.document.getElementById('header_logo').style.display='inline';
		this.document.getElementById('header_module_menu').style.display='inline';

		Set_Cookie('showHeader','true',30,'/','','');
		var showHeader = Get_Cookie('showHeader');
		document['header_img'].src = '../../themes/${sessionScope.loginUser.theme}/skin/${sessionScope.loginUser.themePath}/images/basic_search.gif';
		
		parent.ff_all.rows= "127,0,*,0";
	}else{
		this.document.getElementById('header_logo').style.display='none';
		this.document.getElementById('header_module_menu').style.display='none';

		Set_Cookie('showHeader','false',30,'/','','');
		var showHeader = Get_Cookie('showHeader');
		document['header_img'].src = '../../themes/${sessionScope.loginUser.theme}/skin/${sessionScope.loginUser.themePath}/images/advanced_search.gif';	
		
		parent.ff_all.rows = "44,0,*,0";
	}
}
var pos = 1;
function showMenu(offset) {
	if (offset > 0) {
		for(i=1;i<=offset;i++){
		if (pos <= ${fn:length(modules)} - ${modulenum}) {
			document.getElementById("blockmenu_" + pos).style.display = "none";
			var maxshow = pos + ${modulenum};
			document.getElementById("blockmenu_" + maxshow).style.display = "";
			pos = pos + 1;
			document.getElementById("blockmenu_back").style.display = "";
		}
		}
	}
	
	if (offset < 0) {
		for(i=-1;i>=offset;i--){
		if (pos > 1) {
			pos = pos + -1;
			document.getElementById("blockmenu_" + pos).style.display = "";
			var maxshow = pos + ${modulenum};
			document.getElementById("blockmenu_" + maxshow).style.display = "none";
			document.getElementById("blockmenu_next").style.display = "";
		}
		}
	}
	
	if (pos == 1) document.getElementById("blockmenu_back").style.display = "none";
	if (pos > ${fn:length(modules)} - ${modulenum}) document.getElementById("blockmenu_next").style.display = "none";
}
</script>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
	<TBODY>
		<TR>
			<TD
				style="BACKGROUND-IMAGE: url(../../themes/${sessionScope.loginUser.theme}/images/header_bg.gif)"
				colSpan=3><!-- Top Table Begin -->
			<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
				<TBODY>
					<TR height=50 id="header_logo">
						<TD><IMG style="MARGIN-LEFT: 10px" alt="Company Logo"
							src="../../themes/${sessionScope.loginUser.theme}/images/company_logo.gif"
							border=0></TD>
						<TD class=myArea style="PADDING-RIGHT: 10px" noWrap align=right
							valign="middle">
						<%
							int forum_type = 0;
							try {
								forum_type = Integer.parseInt(Constants.FORUM_TYPE);
							} catch (Exception e) {
							}
							String url = "", target = "";

							if (forum_type == 0) {
								url = "/modules/forum/forums.do?method=list";
							} else {
								url = "/modules/forum/login_cwbbs.jsp";
								target = "target=_blank";
							}
						%> <!--
                <A class=myArea 
            href="<c:url value="/modules/forum/forums.do?method=list"/>">${header_menu_forum}</A>&nbsp;|&nbsp; 
            --> <!--
                <A class=myArea 
            href="<c:url value="/help/index.jsp"/>" target="_blank">${header_menu_help}</A>&nbsp;|&nbsp; 
            -->
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td width="45%">&nbsp;</td>
								<td valign="top" width="40">
								<%
									if (!"true".equals(Constants.EAS)) {
								%> <img style="cursor:hand"
									onclick="toggleMenu('message');parent.ff_main.location.href='<c:url value="/themes/home/frame.do?page=main&jump="/>' + encode('/modules/message/messages.do?ec_s_createdate=desc');"
									id="messageImg" name="messageImg"
									src="../../themes/${sessionScope.loginUser.theme}/images/top_message.gif"
									border="0" align="middle" title="${header_menu_message}">
								<%
									}
								%>
								</td>
								<td valign="top" width="45">
								<%
								if(org.springside.core.Constants.PROJECT_NAME.equals("jrzl")){
								%>
								<FORM action="<%=cn.firstsoft.firstframe.util.ActiveDirectoryUtil.getBaseUrl()%>/exchweb/bin/auth/owaauth.dll" method="POST" name="logonForm" target="_blank">		
									<INPUT type="hidden" name="destination" value="<%=cn.firstsoft.firstframe.util.ActiveDirectoryUtil.getBaseUrl()%>/Exchange">	
									<INPUT type="hidden" name="flags" value="1">	
									<INPUT type="hidden" name="username">
									<INPUT type="hidden" name="password">
									<INPUT type="hidden" name="forcedownlevel" value="1">
									<INPUT type="hidden" name="trusted" value="0">
								</form>
								
								<script language="javascript">
									function emailLogin(){
										document.logonForm.username.value="${sessionScope.loginUser.loginid}";
										document.logonForm.password.value="${sessionScope.loginUser.password}";
										document.logonForm.submit();
									}
								</script>
								
								<A class=myArea
									href="#" onclick="javascript:emailLogin();return false;"><img
									id="eamilImg" name="eamilImg"
									src="../../themes/${sessionScope.loginUser.theme}/images/top_email.gif"
									border="0" align="middle" title="${header_menu_email}"></A>
								<%}else{%>
								<A class=myArea
									href="<c:url value="/modules/email2/email2.do?method=login"/>"><img
									id="eamilImg" name="eamilImg"
									src="../../themes/${sessionScope.loginUser.theme}/images/top_email.gif"
									border="0" align="middle" title="${header_menu_email}"></A>
								<%}%>
								</td>
								<td valign="top" width="45"><img  style="cursor:hand"
									onclick="toggleMenu('message');parent.ff_main.location.href='<c:url value="/themes/home/frame.do?page=main&jump="/>' + encode('<%=url %>');"
									src="../../themes/${sessionScope.loginUser.theme}/images/top_bbs.gif"
									border="0" align="middle" title="${header_menu_forum}"></td>
								<td valign="top" width="45"><img style="cursor:hand"
									onclick="toggleMenu('message');parent.ff_main.location.href='<c:url value="/themes/home/frame.do?page=main&jump="/>' + encode('/modules/address/addressUser.do');"
									src="../../themes/${sessionScope.loginUser.theme}/images/top_address.gif"
									border="0" align="middle" title="${header_menu_address}"></td>
								<td valign="top" width="45"><img style="cursor:hand"
									onclick="toggleMenu('message');parent.ff_main.location.href='<c:url value="/themes/home/frame.do?page=main&jump="/>' + encode('/modules/setting/user.do?method=modifyInfo');"
									src="../../themes/${sessionScope.loginUser.theme}/images/top_setting.gif"
									border="0" align="middle" title="${header_menu_setting}"></td>
								<%
									if ("true".equals(Constants.RTX)) {
								%>
								<td valign="top" width="45"><img style="cursor:hand"
									onClick="loginRtx()"
									src="../../themes/${sessionScope.loginUser.theme}/images/top_rtx.gif"
									border="0" align="middle" title="RTX"></td>
								<%
									}
								%>
								<td valign="top" width="45"><A class=myArea style="cursor:hand"
									href="<c:url value="/j_acegi_logout"/>" target="_top"><img
									src="../../themes/${sessionScope.loginUser.theme}/images/top_exit.gif"
									border="0" align="middle" title="${header_menu_exit}"></A></td>
							</tr>
						</table>
						</TD>
					</TR>
					<TR id="header_module_menu">
						<TD colSpan=2 height="20"
							background="../../themes/${sessionScope.loginUser.theme}/images/emptyTabSpace.jpg">
						<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
							<TBODY>
								<TR height=20>
									<TD><IMG height=30
										src="../../themes/${sessionScope.loginUser.theme}/images/headleft.gif"
										width=20 border=0></TD>
									<TD id="blockmenu_back" style="display:none"><IMG style="CURSOR: hand" 
											title="${header_menu_more}"
											src="../../themes/${sessionScope.loginUser.theme}/images/more_left.gif"
											onclick="javascript:showMenu(-10);"></TD>										
									<c:set var="modulecount" value="0" />
									<c:forEach items="${modules}" var="module">
									<c:set var="modulecount" value="${modulecount + 1}" />
									<TD id="blockmenu_${modulecount}" style="display:<c:if test="${modulecount > modulenum}">none</c:if>">
									<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
										<TBODY>
											<TR height=30>
												<TD><IMG height=30 alt="${module.name}" id="${module.path}_left_img"
													src="../../themes/${sessionScope.loginUser.theme}/images/otherheadTab_left.gif"
													width=10 border=0></TD>
												<TD class=otherTab id="${module.path}_td"
													style="BACKGROUND-IMAGE: url(../../themes/${sessionScope.loginUser.theme}/images/otherheadTab_middle.gif)"
													noWrap><A style="cursor:hand"
													onclick="toggleMenu('${module.path}');parent.ff_main.location.href='<c:url value="/themes/home/frame.do?page=main&jump="/>' + encode('${module.url}');"
													target="ff_main">${module.name}</A></TD>
												<TD><IMG height=30 alt="${module.name}"  id="${module.path}_right_img"
													src="../../themes/${sessionScope.loginUser.theme}/images/otherheadTab_right.gif"
													width=10 border=0></TD>
											</TR>
										</TBODY>
									</TABLE>
									</TD>
									</c:forEach>
									<TD id="blockmenu_next" style="display:<c:if test="${fn:length(modules) > modulecount}"></c:if>">									
										<IMG style="CURSOR: hand" 
											title="${header_menu_more}"
											src="../../themes/${sessionScope.loginUser.theme}/images/more.gif"
											onclick="javascript:showMenu(10);"></TD>
									<TD><IMG height=30
										src="../../themes/${sessionScope.loginUser.theme}/images/headright.gif"
										width=10 border=0></TD>
									<TD
										style="BACKGROUND-IMAGE: url(../../themes/${sessionScope.loginUser.theme}/images/emptyTabSpace.jpg)"
										width="100%"><IMG height=1 alt=""
										src="../../themes/${sessionScope.loginUser.theme}/images/blank.gif"
										width=1 border=0></TD>
									<Td align="right"><!-- IFRAME scrolling="no" 
              		marginwidth="0" marginheight="0" frameborder="0" id="checker" name="checker" width="16" height="16" 
              		src='<c:url value="/messages.do?method=checker"/>' 
              		align="middle" allowTransparency="true"></IFRAME --> <script
										type="text/javascript" language="javascript">   
var count = 0;   
function getSystemMessage() {   
    var myAjax = new Ajax.PeriodicalUpdater(   
        'systemMessage',   
        '<c:url value="/messages.do?method=checker"/>',    
        {   
            method: 'get',   
            evalScripts: true,   
            frequency: <%=Constants.MESSAGE_CHECK_INTERVAL%>    
        }   
    );   
}
getSystemMessage();   
</script>
									<div id="systemMessage" style="display: none"></div>
									<div id="divResult2" style="display: none"></div>
									<BGSOUND id="messageSound" LOOP=1
										SRC="<c:url value="/themes/${sessionScope.loginUser.theme}/sounds/jsilence.mid"/>">
									</Td>
								</TR>
							</TBODY>
						</TABLE>
						</TD>
					</TR>
					<TR height=20 id="header_welcome">
						<FORM name=UnifiedSearch><INPUT type=hidden
							value=UnifiedSearch name=action> <INPUT type=hidden
							value=Home name=module> <INPUT type=hidden value=false
							name=search_form>
						<TD class=subTabBar colSpan=2>
						<TABLE height=20 cellSpacing=0 cellPadding=0 width="100%" border=0>
							<TBODY>
								<TR>
									<TD class=welcome id=welcome width="100%"><fmt:message
										key="head.welcome" /> [${sessionScope.loginUser.ucdeptName} -
									${sessionScope.loginUser.deptName}]
									${sessionScope.loginUser.name}, ${currentdate}</TD>
									<TD class=welcome
										style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"
										align=right noWrap><c:if test="${!empty linkss}">
										<SELECT name="link" size="1"
											onChange="if (this.value != '') { window.open(this.value); } else { return false; }">
											<OPTION value="">${header_link_hint}</OPTION>
											<c:forEach items="${linkss}" var="links">
												<option value="${links.url}">${links.name}</option>
											</c:forEach>
										</SELECT>&nbsp;&nbsp;
                </c:if></TD>
									<TD class=welcome><IMG height=8 alt='${header_show_hide}'
										onClick="hideHeader();" style="cursor: hand" id="header_img"
										name="header_img"
										src="../../themes/${sessionScope.loginUser.theme}/skin/${sessionScope.loginUser.themePath}/images/basic_search.gif"
										width=8 border=0>&nbsp;&nbsp;</TD>
								</TR>
							</TBODY>
						</TABLE>
						</TD>
						</FORM>
					</TR>
				</TBODY>
			</TABLE>
			<!-- Top Table End --></TD>
		</TR>
		<TR height="20" bgcolor="#DBDCD6">
			<TD class=lastView noWrap colSpan=3><a style="cursor:hand"
				onclick="toggleMenu('setting');parent.ff_main.location.href='<c:url value="/themes/home/frame.do?page=main&jump="/>' + encode('/modules/setting/user.do?method=selectMenus');"
				title="${header_shortcut_1}"><B>${header_shortcut_2}</B></a><B>:&nbsp;&nbsp;</B>
			<c:set var="shortcutCount" value="0" /> <c:forEach
				items="${shortcuts}" var="shortcut">
				<c:set var="shortcutCount" value="${shortcutCount + 1}" />
				<c:if test="${shortcutCount <= 8}">
					<A class=lastViewLink title=[Alt+${shortcutCount}]
						accessKey=${shortcutCount } style="cursor:hand"
						onclick="toggleMenu('setting');parent.ff_main.location.href='<c:url value="/themes/home/frame.do?page=main&jump="/>' + encode('${shortcut.url}');"><IMG 
	      height=16 alt="${shortcut.name}" 
	      src="../../themes/${sessionScope.loginUser.theme}/images/${shortcut.icon}" 
	      width=16 align=absMiddle border=0>&nbsp;${shortcut.name}</A>&nbsp;&nbsp;&nbsp;
	  </c:if>
			</c:forEach> <c:if test="${shortcutCount == 0}">
		${header_shortcut_3}
      </c:if></TD>
		</TR>
	</TBODY>
</TABLE>
<script type="text/javascript">
toggleMenu('${currentmodule}');
</script>
</BODY>
</HTML>